<template>
	<view>
		<view class="TaskBg">
			<view class="TaskTitleBg">
				<text class="TaskTitle">{{TaskTitle!=null?TaskTitle:"任务详情"}}</text>
			</view>
			<view class="TaskList" v-if="TaskInfo">
				<text class="Task">前置任务：<text>{{TaskInfo.procName}}</text></text>
				<text class="Task">报到点： <text>{{TaskInfo.build.name}}</text></text>
				<text class="Task">报道地址：<text>{{TaskInfo.build.buildAddress}} </text></text>
				<text class="Task">报道描述：<text>{{TaskInfo.description}} </text></text>
			</view>
			<button class="GotoProc" @click="GotoQrCode()">
				<text>我已抵达</text>
			</button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				id: '',
				TaskInfo: null,
				TaskTitle: null
			}
		},
		onLoad(e) {
			let {
				id = ''
			} = e;
			this.id = id;
			this.GetTaskInfo();
		},
		onShow() {
			this.GetTaskInfo();
		},
		methods: {
			GetTaskInfo() {
				uni.request({
					url: this.$httpUrl + '/QrCodeProc/GeTaskDetail',
					// POST/GET
					method: 'POST',
					header: {
						'content-type': 'application/x-www-form-urlencoded'
					},
					data: {
						processId: this.id
					},
					success: success => {
						console.log("获取数据返回的", success.data);
						console.log(success.data.code);
						if (success.data.code === 200) {
							this.TaskInfo = success.data.data;
							this.TaskTitle = success.data.data.preTaskName;
							console.log("this.taskinfo", this.TaskInfo);
							// this.TaskInfo = _TaskInfo;
						}
					},
					fail: (fail) => {
						console.log(fail);
						// 失败回调
					}
				});
			},
			GotoQrCode() {
				console.log("success");
				uni.switchTab({
					url: '../qrcode/index'
				});
			}

		}
	}
</script>

<style>
	.TaskBg {
		position: absolute;
		line-height: 8vh;
		height: 80vh;
		width: 90vw;
		left: 5vw;
		top: 10vh;
		background-color: #FFFFFF;
		border-radius: 20rpx;
		box-shadow: 2rpx 2rpx 10rpx #27347d;
	}

	.TaskTitleBg {
		height: 20%;
	}

	.TaskTitle {
		text-align: center;
		display: block;
		color: white;
		background: #fdbb59;
		padding: 0.2rem;
		font-size: 1rem;
		height: 5vh;
		line-height: 5vh;
		width: auto;
		border-radius: 1vw;
		margin: 1vh 5vw;
		box-shadow: 2rpx 2rpx 10rpx #d49b4b;
	}

	.TaskList {
		height: 60%;
	}

	.Task {
		margin-left: 10vw;
		float: left;
		width: 70vw;
		height: 7vh;
	}

	.GotoProc {
		margin: 0vh 5vw 2vh 5vw;
		/* margin-top:29vh; */
	}
</style>
